<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="text/html;charset=utf-8">
<title>问题详情</title></head>
<link href="resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="resources/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">
<link href="resources/css/index.css" rel="stylesheet">

<body>
	<s:include value="../header-common.jsp" />
<div class="container">
	<div class="row">
		<h1 style="text-align:center;margin-top:0;">问题详情!</h1>
	</div>
	<s:set var="set" value="#{0:'已解决',1:'待分配',2:'待测试',3:'待解决' }"></s:set>
	
	<s:form id="form" action="solveProblem" method="post">
	<table class="table table-striped table-bordered table-hover table-condensed table-responsive">
		<tr class="success">
			<td>所属项目</td><td><s:property value="%{problem.project.projectName}" /></td>
		</tr>
		<tr class="warning">
			<td>提问者</td><td><s:property value="%{employee.employeeName}" /></td>
		</tr>
		<tr class="info">
			<td>问题名称</td><td><s:property value="%{problem.problemName}"/></td>
		</tr>
		<tr class="primary">
			<td>问题描述</td><td><s:property value="%{problem.problemDescription}"/></td>
		</tr>
		<tr class="warning">
			<td>问题状态</td><td>
				<s:property value="#set[problem.problemStatus]" />
				<s:if test='user.role eq "项目经理" && problem.project.projectStatus==2'>
				<div style="float:right;">
					<!-- 待分配：派发给开发员 -->
					<s:if test="problem.problemStatus == 1">
						<s:select name="selectWork" list="mapEmployee" headerKey="0" headerValue="选择开发员" 
							listKey="key" listValue="value"></s:select>
						<button type="button" onclick="payout();" class="btn btn-info">派发</button>
					</s:if>
					
					<!-- 待测试：派发给测试员 -->
					<s:if test="problem.problemStatus == 2">
						<s:select name="selectTest" list="mapEmployee" headerKey="0" headerValue="选择测试员" 
							listKey="key" listValue="value"></s:select>
						<button type="button" onclick="payout();" class="btn btn-info">派发</button>
					</s:if>
				</div>
				</s:if>
			</td>
		</tr>
		<tr class="primary">
			<td>创建时间</td><td><s:date name="%{problem.createTime}" format="yyyy年MM月dd日 HH时mm分ss秒"/></td>
		</tr>
		<tr class="primary">
			<td>问题截图</td><td><img class="imgSize img-rounded"
				src="${pageContext.request.contextPath }/images/${problem.imgPath}"></td>
		</tr>
		<tr class="info">
			<td>问题解答</td>
			<td>
			${problem.problemSolve}
			<s:if test='(problem.problemStatus == 3 && user.role eq "开发员") ||
				problem.problemStatus == 2 && user.role eq "测试员"'>
				<div class="form-group">
					<div class="col-sm-12">
						<div class="input-group col-xs-12">
							<textarea rows="5" class="form-control" name="solve"
								data-bv-notempty data-bv-notempty-message="问题解析不能为空"
								data-bv-stringlength data-bv-stringlength-min="5"
								placeholder="问题解析"></textarea>
						</div>
					</div>
				</div>
			</s:if></tr>
	</table>
	<div class="col-xs-12">
		<div class="btn-group btn-group-justified">
			<s:if test='problem.problemStatus == 3 && user.role eq "开发员" 
				&& problem.project.projectStatus==2'>
				<a class="btn btn-primary"><button type="submit" id="ok"
					style="width:100%;background:none;border:0;margin:0;padding:0;">提交解答</button></a>
			</s:if>
			<s:if test='problem.problemStatus == 2 && user.role eq "测试员"
				&& problem.project.projectStatus==2'>
				<a class="btn btn-primary"><button type="submit"
					style="width:100%;background:none;border:0;margin:0;padding:0;">追加问题</button></a>
				<a class="btn btn-primary"><button type="button" onclick="closeProblem();"
					style="width:100%;background:none;border:0;margin:0;padding:0;">关闭问题</button></a>
			</s:if>
			<a href="problemList.do" class="btn btn-primary">问题列表</a>
		</div>
	</div>
	</s:form>
</div>
	<script src="resources/bootstrap/js/jquery.min.js"></script>
	<script src="resources/bootstrap/js/bootstrap.min.js"></script>
	<script src="resources/js/common.js"></script>
</body>
</html>
